/**
*  \file timerecorder.h
*
*  \brief
*
*  \author Michael J. Hohmann  michael.hohmann@linde-mh.de
*
*
*
*
*
*/
#ifndef TIMERECORDER_H_INCLUDED
#define TIMERECORDER_H_INCLUDED

/*================================================[ public includes  ]================================================*/
#include "../cfg/prj.h"
#include "../cfg/timerecorder_cfg.h"

/*================================================[ public defines   ]================================================*/

/*================================================[ public datatypes ]================================================*/
struct timerecoder_times
{
    U32 time;
    U32 cycles;
};
typedef struct
{
    U32 Component_work_time;
    U32 Driver_present_time;
    U32 Fan1_open_time;
    U32 Fan2_open_time;
    U32 Forward_switch_time;
    U32 Neutral_switch_time;
    U32 Reverse_switch_time;
    U32 Traction_forward_time;
    U32 Traction_reverse_time;
} Timediag_t;
/*================================================[ public variables ]================================================*/

/*================================================[ inline functions ]================================================*/

/*================================================[ public functions ]================================================*/
/**
*  Initialization.
*
*  Initialize the timerecorder module.
*
*  \return RC_SUCCESS if successful.
*/
RC timerecorder_initialize( void );


/** count the times
*
*   \param channel Time source to count
*   \param value   If time should be counted
*/
void timerecoder_count( enum timerecoder_channel channel, BO value );


/** Cyclic call
*
*  This function should be called cyclically ( eg. every 10 ms)
*/
void timerecorder_cyclic_service( void );


/** call this function from idle
*
*/
void timerecorder_idle_service( void );

U32 timerecoder_get( enum timerecoder_channel channel);
extern Timediag_t time_diag_interface;
/*====================================================================================================================*/

#endif

/***********************************************************************************************************************
*                             Copyright 2020 Linde Material Handling. All rights reserved.                             *
***********************************************************************************************************************/
